package com.jgp.workflow.controller;

import com.jgp.sys.controller.JGPBackController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 项目   jgp-cloud-parent
 * 作者   loufei
 * 时间   2018/11/14
 */
@CrossOrigin
@Controller
@RequestMapping("/workflow/editorController")
public class EditorController extends JGPBackController {
    
    @RequestMapping("/showModelMgr")
    public String showModelMgr() {
        return page("showModelMgr");
    }
    
    @RequestMapping("/showTaskMgr")
    public String showTaskMgr() {
        return page("showTaskMgr");
    }
    
    @RequestMapping("/listModel")
    public String listModel() {
        return page("listModel");
    }
    
    @RequestMapping("/addModel")
    public String addModel() {
        return page("editModel");
    }
    
    @RequestMapping("/editModel/{modelId}")
    public String editModel(@PathVariable("modelId") String modelId, Model model) {
        re(model, "modelId", modelId);
        return page("editModel");
    }
    
    @RequestMapping("/enter/{modelId}")
    public String enter(@PathVariable("modelId") String modelId, Model model) {
        re(model, "modelId", modelId);
        re(model, "roleTreeApi", "/security/admin/adminApiController/treeRole");
        re(model, "orgTreeApi", "/security/admin/adminApiController/treeOrg");
        return page("designer/modeler");//"redirect:/workflow/designer/modeler.html?modelId="+modelId;
    }
    
    @RequestMapping("/listCatagory")
    public String listCatagory() {
        return page("listCatagory");
    }
    
    
    @RequestMapping("addCategory")
    public String addCategory(){
        return page("editCategory");
    }
    
    @RequestMapping("selectRoleOrgDialog")
    public String selectRoleOrgDialog(String roleTreeApi,String orgTreeApi ,Model model){
        re(model,"roleTreeApi",roleTreeApi);
        re(model,"orgTreeApi",orgTreeApi);
        return page("selectRoleOrgDialog");
    }
}
